package com.settlement.system.common.enums;

/**
 * @author author
 */
public enum UnificationStatusEunm {
    /**
     * 未匹配
     */
    no_match("未匹配","NM"),
    /**
     * 完成匹配
     */
    complete_match("完成匹配","CM"),
    /**
     * 正在汇总
     */
    waiting_push_nc("正在汇总","WPC"),
    /**
     * 完成汇总
     */
    complete_push_nc("完成汇总","CPN")
    ;
    String name;
    String no;

    UnificationStatusEunm(String name, String no) {
        this.name = name;
        this.no = no;
    }

    public String getName() {
        return name;
    }

    public String getNo() {
        return no;
    }

    /**
     * 根据渠道名称获取渠道编码
     * @param name
     * @return
     */
    public static String getNoByName(String name) {
        UnificationStatusEunm[] enums = UnificationStatusEunm.values();
        for (int index = 0; index < enums.length; index++) {
            if(enums[index].getName().equals(name)){
                return enums[index].getNo();
            }
        }
        return null;
    }

    public static String getNameByNo(String no) {
        UnificationStatusEunm[] enums = values();
        for (int index = 0; index < enums.length; index++) {
            if (enums[index].getNo().equals(no)) {
                return enums[index].getName();
            }
        }
        return null;
    }
}
